<!DOCTYPE html>
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org"
				xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
  <meta charset="utf-8"/>
  <title>图书列表</title>
  <link rel="stylesheet" href="/css/layui.css" media="all"/>
  <script src='/js/jquery-2.0.3.min.js'></script>
  <style>
  
  .body {
  	display:flex;
  	justify-content:center;
  	align-items: center;
  }
  	.box {
  	margin-top:50px;
  		width: 800px;
  	}
  	
  	.box .layui-form-label {
  	width: 500px;
  	}
  	
  	.box .layui-btn {
  	margin-left: 5px;
  	}
  	
  </style>
  <script src="/layui.js"></script>
  <script>
    var layer;
    var $;
    layui.use(['layer'], function () {
    	$ = layui.jquery, layer = layui.layer;
    })
  </script>
  <script>
  /*<![CDATA[*/
  	function generate(id){
	    var msg,url;
	    if(id==0){
	    	msg = "确认重新生成【首页图片轮播】？";
	    	url = "../admin/generateRecommended";
	    }else if(id==1){
	    	msg = "确认重新生成【首页慈善活动】？";
	    	url = "../admin/generateActivity";
	    }else if(id==2){
	    	msg = "确认重新生成【首页用户共享排行】？";
	    	url = "../admin/generateShareRank";
	    }else if(id==3){
	    	msg = "确认重新生成【首页图书借阅排行】？";
	    	url = "../admin/generateBorrowRank";
	    }else if(id==4){
	    	msg = "确认重新生成【微信公众号菜单】？";
	    	url = "../menu/create";
	    }
  		layer.confirm(msg, function(index){
	  		$.ajax({
	  			url:url,
	  			type:"POST",
	  			success:function (data){
  					layer.close(index);
  					layer.msg(data);
	  			}
	  		});
  		});	
  	}
  
  /*]]>*/
  </script>
</head>
<body class="body">
<div class="box layui-form layui-form-pane">
	  <label class="layui-form-label">点击以下按钮，重新生成对应模块：</label>
	  <br/><br/><br/><br/>
	  <button class="layui-btn" onclick="generate(0)">首页图片轮播</button>
      <button class="layui-btn" onclick="generate(1)">首页慈善活动</button>
      <button class="layui-btn" onclick="generate(2)">首页用户共享排行</button>
      <button class="layui-btn" onclick="generate(3)">首页图书借阅排行</button>
      <button class="layui-btn" onclick="generate(4)">微信公众号菜单</button>
</div>
  
</body>
</html>